Skip to content

feat: add LLM Gateway provider#7847

Open
smakosh wants to merge 19 commits intoanomalyco:devfrom
smakosh:feat/llmgateway-provider
Open

feat: add LLM Gateway provider#7847
smakosh wants to merge 19 commits intoanomalyco:devfrom
smakosh:feat/llmgateway-provider

Conversation

@smakosh
Copy link
Copy Markdown

@smakosh smakosh commented Jan 11, 2026

What does this PR do?

How did you verify your code works?

Fixes: #7848

@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title Add LLM Gateway provider doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@smakosh smakosh changed the title Add LLM Gateway provider feat: add LLM Gateway provider Jan 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

Related PR:

The other result (#4477 - Gatewayz.ai) is a different gateway provider and not directly related.

smakosh and others added 3 commits February 24, 2026 19:59
Add 27 models for LLM Gateway provider including:
- Claude: 3.5 Sonnet, 3.7 Sonnet, Sonnet 4.5, Opus 4.5
- GPT: 4o, 4o-mini, 4.1, o3-mini, o3
- Gemini: 2.0 Flash, 2.5 Flash, 2.5 Pro
- Grok: 3, 3 Mini, 4
- DeepSeek: V3, R1
- Llama: 3.3 70B, 4 Scout
- Qwen: Plus, Qwen3 Max
- GLM: 4.5, 4.7
- Mistral Large
- Kimi K2
- Sonar Pro

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@smakosh smakosh force-pushed the feat/llmgateway-provider branch from 9b4c3ab to 0d8f6d7 Compare February 24, 2026 19:05
smakosh and others added 5 commits March 17, 2026 17:31
Resolve conflicts:
- use-providers.ts: keep both opencode-go and llmgateway entries
- bun.lock: regenerated after merge

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep only 53 models with tool calling support suitable for coding
(Claude, GPT, Gemini, DeepSeek, Grok, Kimi, Qwen, Llama, Mistral).
Remove image-gen, search-only, guard, nano, and dated variant models.
Add X-Source header to OpenRouter provider config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Include all 126 models that support tool calling and text output.
Only image generation models are excluded. This adds back GLM, Minimax,
Seed, Kimi, and other models that were previously over-filtered.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve conflicts:
- provider.ts: keep both gitlab-ai-provider rename and llmgateway import
- bun.lock: accept upstream ghostty-web entry with sha hash

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment on lines +20 to +27
const BUILTIN_PROVIDERS: Record<string, Provider> = {
llmgateway: {
id: "llmgateway",
name: "LLM Gateway",
api: "https://api.llmgateway.io/v1",
npm: "@llmgateway/ai-sdk-provider",
env: ["LLM_GATEWAY_API_KEY", "LLMGATEWAY_API_KEY"],
models: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you PR this in models.dev instead? I dont want to maintain a list in source code here if we can help it...

Copy link
Copy Markdown
Author

@smakosh smakosh Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The llmgateway models are now sourced from models.dev instead of being
maintained as a hardcoded list in source code.

See: anomalyco/models.dev#698

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@smakosh smakosh requested a review from rekram1-node March 23, 2026 20:59
"google",
"openrouter",
"vercel",
"llmgateway",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can drop this

anthropic: 4,
openrouter: 5,
vercel: 6,
llmgateway: 7,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cam drop this

Comment on lines +43 to +44
case "@llmgateway/ai-sdk-provider":
return "llmgateway"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be necessary because the provider name is llgateway already


- `openai/gpt-4.1`
- `openrouter/google/gemini-2.5-flash`
- `llmgateway/glm-4.7`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can drop this

:::

So if you are using a model through something like OpenRouter, you can never be
So if you are using a model through something like OpenRouter or LLM Gateway, you can never be
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can drop this

smakosh and others added 3 commits March 26, 2026 21:40
# Conflicts:
#	bun.lock
#	packages/opencode/package.json
Remove unnecessary llmgateway entries from popular providers list,
provider priority map, transform.ts provider name mapping, and
docs references per reviewer suggestions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@smakosh smakosh requested a review from rekram1-node March 26, 2026 20:44
@smakosh
Copy link
Copy Markdown
Author

smakosh commented Mar 26, 2026

Thank you for your review Aiden! applied your feedback, lmk if I missed anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Support LLM Gateway as a built-in provider

2 participants